// * 请求响应参数(不包含data)
export interface Result {
	code: string | number;
	msg: string;
}

// * 请求响应参数(包含data)
export interface ResultData<T = any> extends Result {
	data: T;
}

// * 分页响应参数
export interface ResPage<T> {
	rows: T[];
	pageNum: number;
	pageSize: number;
	total: number;
}

// * 分页请求参数
export interface ReqPage {
	pageNum: number;
	pageSize: number;
}

// * 登录
export namespace Login {
	export interface ReqLoginForm {
		user_name: string;
		password: string;
	}
	export interface ResLogin {
		token: string;
	}
	export interface ResAuthButtons {
		[propName: string]: any;
	}
}

export namespace User {
	export interface UserInfo {
		id: number;
		user_name: string;
		is_admin: boolean;
		name: string;
		user_image: string;
		description: string;
		user_focus: number;
		user_fans: number;
		createdAt: string;
		updatedAt: string;
		roles: Role[] | number[];
	}

	export interface Register {
		user_name: string;
		password: string;
	}

	export interface Role {
		id: number;
		name: string;
		permissions: Permission[] | number[];
		createdAt: string;
		updatedAt: string;
	}

	export interface Permission extends Role {
		action: string;
	}
}
